package com.sxdx.controller;

import com.sxdx.common.Result;
import com.sxdx.entity.LoginUser;
import com.sxdx.entity.Menu;
import com.sxdx.service.IMenuService;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

/**
 * 展示不同用户的不同菜单，实现权限控制
 */
@RestController
public class MenuController {
    @Resource
    private IMenuService menuService;

    @PostMapping("/menu-tree")
    public Result getMenu( LoginUser loginUser){
        List<Menu> allMenuTree = menuService.getMenuTree(loginUser);
        return Result.success(allMenuTree);
    }
}
